﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using DAL.Dao;
using DAL;

namespace BLL
{
    public class ComplaintBagImpl : IDisposable
    {
        private static ComplaintBagDaoimpl _dao;
        public int ExistNum { get { return _dao.ExistNum; } private set { } }

        public ComplaintBagImpl()
        {
            if (_dao == null)
                _dao = new ComplaintBagDaoimpl();
            
        }
        public int GetSenderUserIDByBagID(string bagID)
        {
            return _dao.GetSenderUserIDByBagID(bagID);  
        }

        public int GetSenderUserIDByComplaintID(int bagID)
        {
            return _dao.GetSenderUserIDByComplaintID(bagID);
        }

        public int GetGetterUserIDByComplaintID(int complaintID)
        {

            return _dao.GetGetterUserIDByComplaintID(complaintID);
        }



        public IList<ComplaintBag> GetList()
        {
            return _dao.GetList();
        }


        public IList<ComplaintBag> GetList(string username, string phone)
        {
            return _dao.GetList( username,  phone);
        }

        public (int,IList<ComplaintBag>) GetList(string username,string phone,int rows,int page)
        {
            return _dao.GetList(username,phone,rows,page);
        }



        public (int,IList<ComplaintBag>) GetList(int rows,int page)
        {
            return _dao.GetList(rows,page);
        }

        public Complaint Find(int id)
        {
            return _dao.Find(id);
        }



        public bool Update(int id,Complaint complaint)
        {
            return _dao.Update(id,complaint);
        }

        public bool Delete(ComplaintBag complaint)
        {
            return _dao.Delete(complaint);
        }

        public bool Delete(int id)
        {
            return  _dao.Delete(id);
        }

        public void Dispose()
        {
            _dao.Dispose();
        }
        public bool Add(Complaint complaint)
        {
            return _dao.Add(complaint);
          
        }
        //public IList<ComplaintBag> GetComplaintInfo(string username)
        //{
        //    var rs = _dao.GetComplaintInfo(username);
        //    return rs;
        //}

    }
}
